Build using Jenkins & Deploy using Nife

Before proceeding further, lets install Jenkins on top of EC2 instance and Configure Jenkins.

Installation process on Jenkins can be done using these steps

To deploy to Jenkins we essentially need four things.
  1. The application you want to deploy.
  2. A runnable copy of nifectl.toml
  3. A nife.toml file.
  4. Your Nife API Token.

On Jenkins, the CI/CD system takes care of the first requirement for you.

Step 1- Lets create our First pipeline. Click on New Item.
Jenkins Deployment.
Enter a job name and select Pipeline as shown in the image below.
Jenkins Pipeline
Step 2 -In the configuration page of Jenkins, enter the github repo URL.Jenkins configuration.
Step 3 -In the pipeline section, we have written a pipeline script.Jenkins Pipeline Script
For Configuring with Nife
Prerequisite:#
  • Before proceeding further we install nifectl with the command in the github actions.
  • We need nife.toml file and an auth token.
The nife.toml file will be needed to create using nife init so you will likely to do this locally and then add to the repository, for nifectl to find when it is run in deployment.

For the API token use nifectl, using the token previously logged with.

Run nifectl auth token and this will display the token your session. Use this token value into NIFE_ACCESS_TOKEN environment variables inside the deployment.

Environment variable
Ready to Deploy

We are now ready to build the job. On the Jenkins web UI, head to dashboard. You will see jobs and the deployment job running.

Now Click on the running badges to see the progress.

Job’s Done

And that’s pretty much for deploying with Jenkins CI/CD system. There’s lot more functionality in there allowing you to structure the pipeline as you want and trigger different jobs at different times.